<link type="text/css" href="/admins/js/pagerView/pager-view.css" rel="stylesheet" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/admins/js/pagerView/pager-view.js"></script>
<style>
    input{
            background-color: #ff9;
            color: #000000;
      }
      textarea{
            background-color: #ff9;
      }
      #billboy{
            font-size: 14px;
            width: 98%;
            float: left;
      }
      #useredit{
            padding-left: 20px;
            padding-bottom: 10px;
            float: left;
      }
      td{
            background-color: #eee;
      }
      #bf{
            background-color: #eee;
            text-align: right;
            width: 220px;
            line-height: 48px;
      }
      #cf{
            width: 530px;
      }
      .error{
            color: red;
      }
</style>
<?php
/* if($this->ma == 1){
  echo '<script language="javascript" type="text/javascript">alert("添加成功！");location.href = "/admini/manageadmin/index/"; </script>';
  }else if($this->ma == 2){
  echo '<script language="javascript" type="text/javascript">alert("登录名已存在！");</script>';
  }

 */
?>
<div id='billboy'>
      <div id='useredit' >
            <form method="post" action="/admini/autotask/addjob/id/<?=$this->jobdetail->id?>" id="formstore">
                  编辑任务
                  <table width="920"  cellpadding="0" cellspacing="0">
                        <tr>
                              <td id='bf'>任务名称：</td>
                              <td id='cf'  colspan="3">
                                    &nbsp;&nbsp;<input type="text" id="name" name="name" class="required" value='<?=$this->jobdetail->name?>' />
                              </td>
                        </tr>
                        <tr>
                              <td id='bf'>是否激活：</td>
                              <td id='cf' colspan="3">
                                    &nbsp;<label><input type="radio" name="isDisable" <?php if($this->jobdetail->isDisable==1)echo 'checked' ?>  value="1"/>启用</label>
                                    &nbsp;<label><input type="radio" name="isDisable"<?php if($this->jobdetail->isDisable==0)echo 'checked' ?> value="0"/>禁用</label>
                              </td>                 
                        </tr>                       
                       <tr>
                             <td id="bf">任务描述：</td>
                             <td style="width:200px;height: 80px;" colspan="3">
                                   <textarea id="description" name="description" class="required" rows="3"cols="60%"><?=$this->jobdetail->description?></textarea>                 
                             </td>
                       </tr>
                       <tr>
                             <td id="bf">任务类型：</td>
                             <td colspan="3">&nbsp;
                                   <label>
                                         <input type="radio" id="radio_1" <?php if($this->jobdetail->type==1)echo 'checked' ?> name="type" value="1"/>运行代码
                                   </label>
                                   &nbsp;<label>
                                         <input type="radio" id="radio_2"<?php if($this->jobdetail->type==0)echo 'checked' ?> name="type" value="0"/>打开网页
                                   </label>                                       
                             </td>
                       </tr>
                       <tr>
                             <td>
                                   
                             </td>
                             <td style="width:200px;height: 80px;" colspan="3">
                                   
                                         <?php 
                                         if($this->jobdetail->type==1)
                                         {
                                               echo '<div id="content1"><div>请输入代码：</div><textarea name="content1"  rows="3" cols="60">';
                                               echo$this->jobdetail->content;
                                               echo '</textarea></div>';
                                               echo'<div id="content2" style="display:none;">请输入网址：<input type="url" name="content2" style="width:300px; height:22px;"/></div>';
                                         }
                                         
                                         if($this->jobdetail->type==0)
                                        {
                                                echo '<div id="content1"style="display:none;"><div>请输入代码：</div><textarea name="content1"  rows="3" cols="60"></textarea></div>';
                                                echo '<div id="content2">请输入网址：<input type="url" name="content2"';
                                                echo'value='.$this->jobdetail->content;
                                               echo ' style="width:300px; height:22px;"/></div>';
                                         }
                                        ?>

                             </td>
                       </tr>
                        <tr>
                             <td id="bf" valign="top">时间设置：</td>
                             <td colspan="3" height="150px" valign="top">执行时间 <select id="time" name="time">
                                         <option value="-1" id="other"<?php if($this->jobdetail->time==-1)echo 'selected' ?>>其他</option>
                                         <option value="0" id="others"<?php if($this->jobdetail->time==0)echo 'selected' ?>>00:00</option>
                                   <?php
                                          $circle = 24;
                                          $i=1;
                                        
                                          echo '';
                                          while ($i < $circle) {
                                                if($i<10)
                                                {
                                                      $i='0'.$i;
                                                }
                                                echo"<option value={$i} id='others'";
                                                if($this->jobdetail->time==$i){echo"selected";}
                                                echo">{$i}:00</option>";
                                                $i++;
                                          }
                                          
                                                       
                                   ?>
                                   </select>
                                         <span id="timeLogspan" <?php if($this->jobdetail->time!=-1)echo 'style="display:none;"'?>> 
                                               请输入任务循环执行间隔时间<input id="timeLog" name="timeLog"value=<?=$this->jobdetail->timeLog?>>分钟
                                         </span>
                                                          
                                   <br/>  
                                          <label><input type="radio" id="dateType0" name="dateType"<?php if($this->jobdetail->dateType==0)echo 'checked=""'?> value="0"/>每日执行</label>
                                          <label><input type="radio" id="dateType1" name="dateType"<?php if($this->jobdetail->dateType==1)echo 'checked=""'?> value="1"/>按周执行</label>
                                          <label><input type="radio" id="dateType2" name="dateType"<?php if($this->jobdetail->dateType==2)echo 'checked=""'?> value="2" />按月执行</label>

                                          <br/>
                                          <?php
                                          $temp=$this->jobdetail->dateValue; //要遍历的字符串
                                         
                                          ?>
                                          <div id="theweek" <?php if($this->jobdetail->dateType!=1)echo 'style="display:none;"'?> >
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="1"<?php if(strpos($temp, '1')>=0)echo'checked=""'?> />周一</label>
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="2"<?php if(strpos($temp, '2'))echo'checked=""'?> />周二</label>
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="3"<?php if(strpos($temp, '3'))echo'checked=""'?> />周三</label>
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="4"<?php if(strpos($temp, '4'))echo'checked=""'?> />周四</label>
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="5" <?php if(strpos($temp, '5'))echo'checked=""'?>/>周五</label>
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="6" <?php if(strpos($temp, '6'))echo'checked=""'?>/>周六</label>
                                                <label style="font-size: 13px;margin-left: 15px;"><input id="dateValue" name="dateValue1[]" type="checkbox" value="7" <?php if(strpos($temp, '7'))echo'checked=""'?>/>周日</label>
                                          </div>
                                         
                                          <div id="themonth"<?php if($this->jobdetail->dateType!=2)echo 'style="display:none;"'?>>
                                                <?php
                                                $temp=$this->jobdetail->dateValue;
                                                $circless = 32;
                                                $i = 1;
                                                while ($i < $circless) {
                                                      $j=$i;
                                                      if($j<10)
                                                            $j='0'.$j;
                                                      echo"<label style='width:80px;font-size: 13px;margin-left: 15px;' ><input name='dateValue2[$i]'";
                                                      if(strpos($temp, "$i"))echo'checked=""';
                                                      echo" type='checkbox' value='{$i}' />{$j}号</label>";
                                                      if ($i % 10 == 0)
                                                            echo '<br/>';
                                                      $i++;
                                                }
                                                ?>
                                          </div>
                              </td>
                        </tr>
                        <tr>
                              <td id='bf'></td>
                              <td id='cf'  colspan="3">
                                    <input class="anvbotton" type="submit" value=" 提  交   " />
                              </td>
                        </tr>
                  </table>
            </form>
      </div>
</div>
<script language='javascript'>
      $(function() {
            //必填项的控制
            $('form').validate();
            //输入类型的控制，及内容
            $("#radio_1").click(function() {

                  $("#content2").hide();
                  $("#content1").show();

            });
            $("#radio_2").click(function() {

                  $("#content2").show();
                  $("#content1").hide();

            });
            //区域显示控制
            $("#dateType2").click(function() {

                  $("#theweek").hide();
                  $("#themonth").show();

            });
             $("#dateType0").click(function() {

                  $("#theweek").hide();
                  $("#themonth").hide();

            });
            $("#dateType1").click(function() {

                  $("#theweek").show();
                  $("#themonth").hide();

            });
            $("#other").click(function() {
                  $('#timeLogspan').show();
            });
            $("#others").click(function() {
                  $('#timeLogspan').hide();
            });
             $('#time').change(function(){

            var value=$("select").find("option:selected").val();

            if(value=='-1'){
            $('#timeLogspan').show();
            }else{
                  $('#timeLogspan').hide();
            }

            });
      });

              
</script>